import time

def bublesort(arr, N):
    for i in range(N-1):

        for j in range(i-N):
            print(arr[j], arr[j+1])
            if arr[j] < arr[j+1]:
                print(arr)
                arr[j+1], arr[j] = arr[j], arr[j+1]
    return arr
def readlist(filename):
    file = open(filename, 'r')
    data = file.readlines()
    return data


m1 = readlist("m1_sorted.txt")
m2 = readlist("m2_reverse.txt")
m3 = readlist("m3_shuffle.txt")

size = len(m1)

t_start = time.time()
bublesort(m1, size)
t_end = time.time()
print("m1_sorted {(t_end-t_start)*100} milliseconds")


size = len(m2)
t_start = time.time()
bublesort(m2, size)
t_end = time.time()
print("m2_reverse {(t_end-t_start)*100} milliseconds")

size = len(m3)

t_start = time.time()
bublesort(m3, size)
t_end = time.time()
print("m3_shuffle.txt {(t_end-t_start)*100} milliseconds")



